package com.chaoyi.dao.redis;

import com.chaoyi.config.RedisConfig;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

public enum RedisPool {
	INSTANCE;
	private final JedisPool pool;
	
	RedisPool(){
		pool = new JedisPool(new JedisPoolConfig(), RedisConfig.redisIp,RedisConfig.redisPort);
	}
	
	public Jedis getResource(){
		return pool.getResource();
	}
	
	public void destroy(){
		pool.destroy();
	}
	
}
